package com.infore.operation.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.infore.operation.utils.json.NullArrayJsonSerializer;
import com.infore.operation.utils.json.NullSerializer;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

/**
 * Created by Administrator on 2017/9/15.
 */
public class FaultType implements RowMapper<FaultType> {
    private Integer id;
    private String name;
//    private String names;
//    private Integer namesId;
    private String code;

    @JsonSerialize(nullsUsing = NullSerializer.class)
    private String remark;
    @JsonSerialize(nullsUsing = NullSerializer.class)
    private Integer pid;
    private Integer type;
//    private String types;
    @JsonSerialize(nullsUsing = NullArrayJsonSerializer.class)
    private List<FaultType> faultTypes;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public List<FaultType> getFaultTypes() {
        return faultTypes;
    }

    public void setFaultTypes(List<FaultType> faultTypes) {
        this.faultTypes = faultTypes;
    }

//    public String getTypes() {
//        return types;
//    }
//
//    public void setTypes(String types) {
//        this.types = types;
//    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

//    public String getNames() {
//        return names;
//    }
//
//    public void setNames(String names) {
//        this.names = names;
//    }
//
//    public Integer getNamesId() {
//        return namesId;
//    }
//
//    public void setNamesId(Integer namesId) {
//        this.namesId = namesId;
//    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getPid() {
        return pid;
    }

    public void setPid(Integer pid) {
        this.pid = pid;
    }

    @Override
    public FaultType mapRow(ResultSet rs, int i) throws SQLException {
        FaultType faultType = new FaultType();
        faultType.setId(rs.getInt("id"));
        faultType.setCode(rs.getString("code"));
        faultType.setName(rs.getString("name"));
        faultType.setPid(rs.getInt("pid"));
        faultType.setRemark(rs.getString("remark"));
        faultType.setType(rs.getInt("type"));
        return faultType;
    }
}
